<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:pe="http://primefaces.org/ui/extensions">

    <h:body>

        <ui:composition template="/resources/template/template.xhtml">

            <ui:define name="content">
                <h:form>
                    <p:panel header="Staff List" >
                        <p:panel>
                            <h:panelGrid columns="1">
                                <p:commandButton ajax="false" value="Fill All" 
                                                 action="#{staffController.createStaffList}"
                                                  onclick="onSubmitButton();"/>
                                <p:commandButton ajax="false" value="Fill Staff Only" 
                                                 action="#{staffController.createStaffOnly}"
                                                  onclick="onSubmitButton();"/>
                                
                                <p:commandButton ajax="false" value="Fill Doctors,Consultant" 
                                                 action="#{staffController.createDoctorsOnly}"
                                                  onclick="onSubmitButton();"/>

                                <p:commandButton ajax="false" value="Fill All(Staff who has no speciality)"
                                                 action="#{staffController.createStaffListWithOutSpecility}" 
                                                  onclick="onSubmitButton();"/>
                            </h:panelGrid>
                            <p:commandButton ajax="false" value="Excel" styleClass="noPrintButton" onclick="onSubmitButton();" >
                                <pe:exporter type="xlsx" target="tbl1" fileName="Staff_Without_Specility"  />
                            </p:commandButton>
                            <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" >
                                <p:printer target="tbl1" />
                            </p:commandButton>
                        </p:panel>
                        <p:panel >
                            <p:dataTable value="#{staffController.staffWithCode}"  var="s" id="tbl1" rowIndexVar="i">
                                <p:column headerText="No">
                                    <p:outputLabel value="#{i+1}" />
                                </p:column>
                                <p:column headerText="Code">
                                    <p:outputLabel value="#{s.codeInterger}" />
                                </p:column>
                                <p:column headerText="Name">
                                    <p:outputLabel value="#{s.person.nameWithTitle}" />
                                </p:column>
                                <p:column headerText="Specility">
                                    <p:outputLabel value="#{s.speciality.name}" />
                                </p:column>
                                <p:column headerText="Creater">
                                    <p:outputLabel value="#{s.creater.staff.person.nameWithTitle}" />
                                </p:column>
                            </p:dataTable>
                        </p:panel>
                    </p:panel>
                </h:form>
            </ui:define>


        </ui:composition>

    </h:body>
</html>
